home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 515 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. From: tim@franck.Princeton.EDU (Tim Hollebeek)
  2. Message-ID: <4g5ddd$56t@cnn.Princeton.EDU>
  3. X-Original-Date: 17 Feb 1996 20:22:05 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 19 Feb 96 02:23:48 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: default template args in a typedef
  9. Organization: Princeton University
  10. X-Newsreader: TIN [version 1.2 PL2]
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMSffQOEDnX0m9pzZAQHvUQF9E/SV4/M+SZ7MTeCeYaJ7t3i6nTKCdXlD
  13.     6At3RLfrJGkc7ht7ybJDEKU4gewisi4m
  14.     =tY3B
  15.  
  16. Is this legal?
  17.  
  18. -------
  19. template <class T>
  20. class X {
  21. };
  22.  
  23. template <class T, class U = X<T> >
  24. class Y {
  25. };
  26.  
  27. typedef Y<double, X<double> > Z1;
  28. typedef Y<double> Z2;
  29.  
  30. int main() {
  31.     Z1 z1;
  32.     Z2 z2; // <--- here
  33. }
  34. -------
  35.  
  36. g++ 2.7.2 doesn't mind Z1, but gives:
  37.  
  38. aggregate `Y<...> z2' has incomplete type and cannot be initialized
  39.  
  40. on the Z2 line.
  41.  
  42. ---------------------------------------------------------------------------
  43. Tim Hollebeek      | Disclaimer :=> Everything above is a true statement,
  44. <space for rent>   |                for sufficiently false values of true.
  45. Princeton Univ.    | email: tim@wfn-shop.princeton.edu
  46. -------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
  47. ---
  48. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  49.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  50.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  51.